<?php


/*
 * report_engine
 * Created on : 18 juin 2010
 * Author     : utilisateur
 * Copyright  : Harlie (c)2010
 */

if (!defined('DS'))
	define('DS', DIRECTORY_SEPARATOR);
if (!defined('LOCAL_REPORT_ENGINE_HOME_PATH'))
	define('LOCAL_REPORT_ENGINE_HOME_PATH', str_replace("/", DS, dirname(__FILE__) . "/../../../../report_engine-1.0/src"));

$path = array (
	LOCAL_REPORT_ENGINE_HOME_PATH,
	LOCAL_REPORT_ENGINE_HOME_PATH . DS . 'core',
	LOCAL_REPORT_ENGINE_HOME_PATH . DS . 'core' . DS . 'default',
	LOCAL_REPORT_ENGINE_HOME_PATH . DS . 'engine',
	LOCAL_REPORT_ENGINE_HOME_PATH . DS . 'engine' . DS . 'dompdf',
	LOCAL_REPORT_ENGINE_HOME_PATH . DS . 'engine' . DS . 'smarty',
	LOCAL_REPORT_ENGINE_HOME_PATH . DS . 'factory'
);

set_include_path(
	get_include_path() . PATH_SEPARATOR .
	implode(PATH_SEPARATOR, $path)
);


define('SMARTY_SPL_AUTOLOAD', 1);

include_once(LOCAL_REPORT_ENGINE_HOME_PATH.DS."ReportEngine.inc.php");


function ReportAutoLoadFunction($class)
{
    $_class = mb_strtolower($class);
	if ( is_file(SMARTY_SYSPLUGINS_DIR . $_class . '.php') )
        include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
	elseif ( is_file(DOMPDF_INC_DIR . "/" . $_class . ".cls.php") )
		include(DOMPDF_INC_DIR . "/" . $_class . ".cls.php");
	else
		YiiBase::autoload($class);
} 

spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register("ReportAutoLoadFunction");
spl_autoload_register(array('YiiBase','autoload'));

ReportEngineLoader::LoadLibrary ("Smarty");
ReportEngineLoader::LoadLibrary ("dompdf");


//throw new Exception(	get_include_path());
?>
